<?php

declare(strict_types=1);

namespace app\common\model\sys;

use think\Model;
use app\common\traits\ModelTrait;
use think\model\concern\SoftDelete;

/**
 * 系统用户表 (员工表也并一起了) -模型
 * @author:kaige
 * @date:2022-04-25
 * @copyright ©2022 泉州市盛筑信息科技有限公司 版权所有
 */
class SysUser extends Model
{
  use SoftDelete;
  //时间自动存储
  protected $autoWriteTimestamp = true;
  protected $createTime = 'create_time';
  protected $updateTime = 'update_time';
  //软删除位
  protected $deleteTime = 'delete_time';

  // 设置字段信息(避免多一次查询的开销)
  protected $schema = [
    'id'                  =>'int',
    'client_id'           =>'string',
    'bn'                  =>'string',
    'un'                  =>'string',
    'pwd'                 =>'string',
    'e_pwd_n'             =>'int',
    'ln'                  =>'int',
    'status'              =>'int',
    'type'                =>'int',
    'sex'                 =>'int',
    'tel'                 =>'string',
    'avatar'              =>'string',
    'sign'                =>'string',
    'u_friend'            =>'string',
    'dept_id'             =>'int',
    'dept_id_name'        =>'string',
    'dept_other'          =>'string',
    'dept_other_name'     =>'string',
    'dept_path'           =>'string',
    'ranking_id'          =>'string',
    'ranking_id_name'     =>'string',
    'ranking_other'       =>'string',
    'ranking_other_name'  =>'string',
    'super_id'            =>'int',
    'super_name'          =>'string',
    'super_path'          =>'string',
    'group_name'          =>'string',
    'real_name'           =>'string',
    'pingyin_name'        =>'string',
    'email_pwd'           =>'string',
    'company_id'          =>'int',
    'company_d_id'        =>'int',
    'phone'               =>'string',
    'weixin_id'           =>'string',
    'entry_time'          =>'int',
    'dimission_time'      =>'int',
    'theme'               =>'string',
    'is_app_push'         =>'int',
    'last_push_time'      =>'int',
    'online'              =>'int',
    'last_ip'             =>'string',
    'last_time'           =>'int',
    'is_card'             =>'int',
    'sz_salt'             =>'string',
    'on_duty'             =>'int',
    'sort'                =>'int',
    'bankcard'            =>'string',
    'kaihuhang'           =>'string',
    'base'                =>'decimal',
    'create_time'         =>'int',
    'update_time'         =>'int',
    'delete_time'         =>'int',
    'email'               =>'string',
    'contract_code'       =>'string',
    'contract_file'       =>'string',
    'quit_file'           =>'string',
    'is_kq'               =>'int',
    'is_balance'          =>'int',
    'emergency_contact'   =>'string',
    'emergency_phone'     =>'string',
    'is_marry'            =>'int',
    'educational'         =>'string',
    'id_card'             =>'string',
    'id_card_front'       =>'string',
    'id_card_verso'       =>'string',
    'nation'              =>'string',
    'address'             =>'string',
    'card_address'        =>'string',
    'politics'                =>'string',
    'educ_img'                =>'string',
    'graduate_institutions'   =>'string',
  ];

  use ModelTrait;

  public function glcompany()
  {
    return $this->hasOne('app\common\model\hrm\HrmCompany', 'id', 'company_id')->bind(['company_name' => 'name']);
  }
}
